/**
 * 
 */
package org.yelongframework.model.support.spring.jdbc;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;
import org.yelongframework.model.support.mybatis.mapper.GenericMapperParamBuilder;
import org.yelongframework.model.support.mybatis.sql.MybatisParamMap;
import org.yelongframework.model.support.mybatis.sql.executor.AbstractMybatisSqlExecutor;
import org.yelongframework.model.support.mybatis.sql.executor.MybatisSqlExecutor;
import org.yelongframework.sql.SqlRuntimeException;

/**
 * 添加事务。由于{@link Transactional}注解不适用于父类方法，所以在此抽象类中将{@link MybatisSqlExecutor}包含及其父类中所有的方法实现默认实现，以实现事务
 * 
 * @since 1.0.0
 */
@Transactional
public abstract class TransactionalMybatisSqlExecutor extends AbstractMybatisSqlExecutor implements MybatisSqlExecutor {

	// ==================================================constructor==================================================

	public TransactionalMybatisSqlExecutor(GenericMapperParamBuilder genericMapperParamBuilder) {
		super(genericMapperParamBuilder);
	}

	// ==================================================sqlExecutor==================================================

	@Override
	public Integer executeUpdate(String sql, Object... params) throws SqlRuntimeException {
		return super.executeUpdate(sql, params);
	}

	@Override
	public List<Map<String, Object>> executeQuery(String sql, Object... params) throws SqlRuntimeException {
		return super.executeQuery(sql, params);
	}

	@Override
	public Map<String, Object> executeQueryRow(String sql, Object... params) throws SqlRuntimeException {
		return super.executeQueryRow(sql, params);
	}

	@Override
	public <T> List<T> executeQueryColumn(String sql, Object... params) throws SqlRuntimeException {
		return super.executeQueryColumn(sql, params);
	}

	@Override
	public <T> T executeQuerySingleObject(String sql, Object... params) throws SqlRuntimeException {
		return super.executeQuerySingleObject(sql, params);
	}

	@Override
	public Long executeQueryCount(String sql, Object... params) throws SqlRuntimeException {
		return super.executeQueryCount(sql, params);
	}

	// ==================================================mybatisSqlExecutor==================================================

	@Override
	public Integer executeUpdate(String sql, MybatisParamMap mybatisParamMap) {
		return super.executeUpdate(sql, mybatisParamMap);
	}

	@Override
	public List<Map<String, Object>> executeQuery(String sql, MybatisParamMap mybatisParamMap) {
		return super.executeQuery(sql, mybatisParamMap);
	}

	@Override
	public Map<String, Object> executeQueryRow(String sql, MybatisParamMap mybatisParamMap) {
		return super.executeQueryRow(sql, mybatisParamMap);
	}

	@Override
	public <T> List<T> executeQueryColumn(String sql, MybatisParamMap mybatisParamMap) {
		return super.executeQueryColumn(sql, mybatisParamMap);
	}

	@Override
	public <T> T executeQuerySingleObject(String sql, MybatisParamMap mybatisParamMap) {
		return super.executeQuerySingleObject(sql, mybatisParamMap);
	}

	@Override
	public Long executeQueryCount(String sql, MybatisParamMap mybatisParamMap) {
		return super.executeQueryCount(sql, mybatisParamMap);
	}

}
